#ifndef DOWNLOADMANAGER
#define DOWNLOADMANAGER

#include <render\levels\tile.h>
//#include <render\levels\level.h>
#include <base\vec2i.h>
#include <render\observers\downloadObserver.h>
#include <render\threads\threadBase.h>

#include <boost/signal.hpp>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>

#include <vector>

using namespace std;

enum e_request_type {
  NOTHING,
  TERRAIN,
  TEXTURE
};

struct s_download_query {

  e_request_type request_type;
  float distance;
  int level;
  bool visible;
  vec2i tile_id;
  boost::shared_ptr<tile> *tile_ptr;

  s_download_query() {
    distance = 0.0;
    level = 0;
    visible = true;
    tile_id = vec2i(0, 0);
    request_type = NOTHING;
    tile_ptr = NULL;
  }
};

class downloadManager : public threadBase {

  //boost::signal2<void, level &l, tile &t> download_done_sig;
  //vector <level *> levels;

protected:

  virtual void run();

public:

  void addDownloadObserver(downloadObserver *ref);

  downloadManager();
  virtual ~downloadManager();
};

#endif